package com.cddx.logistics.service.impl;

import com.cddx.logistics.domain.dto.WarehousesettingsQueryDTO;
import com.cddx.logistics.domain.pojo.Warehousesettings;
import com.cddx.logistics.domain.vo.WarehouseVO;
import com.cddx.logistics.domain.vo.WarehousesettingsVO;
import com.cddx.logistics.mapper.WarehousesettingsMapper;
import com.cddx.logistics.service.WarehousesettingsService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;

@Service
public class WarehousesettingsServiceImpl implements WarehousesettingsService {
    @Resource
    private WarehousesettingsMapper warehouseMapper;

    @Override
    public PageInfo<WarehousesettingsVO> queryPage(WarehousesettingsQueryDTO queryDTO) {
        PageHelper.startPage(queryDTO.getPage(), queryDTO.getLimit());
        List<WarehousesettingsVO> list = warehouseMapper.queryPage(queryDTO);
        return new PageInfo<>(list);
    }

    @Override
    public boolean add(Warehousesettings warehouse) {
        return warehouseMapper.add(warehouse) > 0;
    }

    @Override
    public boolean update(Warehousesettings warehouse) {
        return warehouseMapper.update(warehouse) > 0;
    }

    @Override
    public boolean delete(Long warehouseId) {
        return warehouseMapper.delete(warehouseId) > 0;
    }

    @Override
    public boolean batchDelete(List<Long> warehouseIds) {
        return warehouseMapper.batchDelete(warehouseIds) > 0;
    }

}